const state = {
    testMsg: window.localStorage.getItem('testMsg') !== null ? JSON.parse(window.localStorage.getItem('testMsg')) : null,
    changeJGZ:null,
};

const mutations = {
    SET_TESTMSG: (state, testMsg) => {
        state.testMsg = testMsg;
        window.localStorage.setItem('testMsg', JSON.stringify(testMsg));
    },
    SET_CHANGEJGZ: (state, changeJGZ) => {
        state.changeJGZ = changeJGZ;
        window.localStorage.setItem('changeJGZ', JSON.stringify(changeJGZ));
    }
};

const actions = {
    newmsg({ commit, state }, message) {
        commit('SET_TESTMSG', message);
    },
    refreshJGZ({ commit, state }, message) {
        commit('SET_CHANGEJGZ', message);
    },
};

export default {
    namespaced: true,
    state,
    mutations,
    actions
};
